<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改专家组管理')" />
    <th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-group-edit" th:object="${tenderExpertexpertGroup}">
            <input name="groupId" th:field="*{groupId}" type="hidden">
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">专家组名称：</label>
                    <div class="col-sm-8">
                        <input name="groupName" th:field="*{groupName}" class="form-control" type="text" required>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">排序：</label>
                    <div class="col-sm-8">
                        <input name="sortOrder" th:field="*{sortOrder}" class="form-control" type="text" required>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">专家组状态：</label>
                    <div class="col-sm-8">
                        <div class="radio-box" th:each="dict : ${@dict.getType('sys_job_status')}">
                            <input type="radio" th:id="${'status_' + dict.dictCode}" name="status" th:value="${dict.dictValue}" th:field="*{status}" required>
                            <label th:for="${'status_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">专家：</label>
                    <div class="col-sm-8">
                        <select id="post" class="form-control select2-multiple" multiple required>
                            <option th:each="post:${posts}" th:value="${post.userId}" th:text="${post.userName}"></option>
                        </select>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: select2-js" />
    <script th:inline="javascript">
        var prefix = ctx + "system/group";
        $("#form-group-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                var data = $("#form-group-edit").serializeArray();
                var expertList = $.form.selectSelects("post");
                data.push({"name": "expertList", "value": expertList});
                $.operate.save(prefix + "/edit", data);
            }
        }

        $(function() {
            $('#post').select2({
                placeholder: "请选择专家",
                allowClear: true
            });
        })
    </script>
</body>
</html>